package com.djx.business.access.controller;

import com.djx.business.access.service.UserService;
import com.djx.commons.response.Result;
import com.djx.commons.response.ResultCode;
import com.djx.entity.access.User;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/userController")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 2021年1月9日
     * 敦佳星
     * 查询用户信息
     * nickName
     * <p>
     *
     * @param map
     * @return
     */
    @RequiresPermissions("api-findUserByNickname")
    @RequestMapping(value = "/findUser", method = RequestMethod.POST)
    public List<User> findUser(@RequestBody Map<String, Object> map) {
        return userService.findUser(map);
    }


    @RequiresPermissions("api-addUser")
    @RequestMapping(value = "/addUser", method = RequestMethod.POST)
    public Result addUser(@RequestBody Map<String, Object> map) {
        return userService.addUser(map);
    }


}
